home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Utilities / Lightspeed C SKEL fldr / Skel header.c < prev    next >
Text File  |  1986-06-17  |  8KB  |  200 lines

  1. /*
  2.  
  3. PROGRAM Skel;
  4.  
  5. Original Lisa Pascal version written by
  6.                  Steve Maker
  7.                  Academic Computing
  8.                  Kiewit Computation Center
  9.                  Dartmouth College
  10.                  July 14, 1984
  11.          
  12. Translated for Megamax C compiler by
  13.          Bill Jefferys
  14.          Astronomy Department
  15.          University of Texas
  16.          Austin TX 78712
  17.          March 11, 1985
  18.          
  19. Simple convert to Lightspeed C by
  20.         Michael Peirce
  21.         1258 Manet Drive
  22.         Sunnyvale, CA 94087
  23.         June 16, 1986
  24.  
  25. Copyright notice:
  26.            SKEL may be copied and used by anyone, so long as that use
  27.            is not for commercial purposes.  Please send significant 
  28.        changes back to Steve Maker for incorporation into future 
  29.        versions.
  30.  
  31. Why SKEL?
  32.            Skel is a skeleton demo program.  Its purpose is to illustrate
  33.            in a clear fashion, isolated from any particular application,
  34.            the basic code for handling a simple Macintosh user interface.
  35.  
  36.            It strives to be correct as far as it goes, without many 
  37.        short-cuts that would lead to trouble in larger applications.
  38.  
  39.            I think of SKEL as a program that does nothing, but does 
  40.        it well.
  41.  
  42. What does SKEL do?
  43.            It handles:
  44.                Events, carefully handling only those which are its
  45.                        business, and passing the others on to their
  46.                        respective handlers.
  47.                A Window, which is filled with Dark Gray, and can be
  48.                        activated or inactivated, updated, dragged
  49.                        and grown but NOT scrolled or closed.
  50.                Menus, including the Apple Menu.  An "About Skel" menu entry
  51.                        is provided.  A File menu offers Rattle and
  52.                Frighten, which just invoke dialog boxes, and Quit.
  53.                Command key equivalents are supported.
  54.                The Desk Accessories, supported in the Apple menu,
  55.                        and correctly meshed with the other features.
  56.                        NOT supported are Undo, Cut, Copy, Paste and Clear
  57.                        (and keyboard equivalents) for desk accessories.
  58.                A Modal Dialog Box, used to communicate with the user.
  59.                Special icons for the application and its related files.
  60.                The Finder information (in the resource file).
  61.  
  62.            In accordance with Macintosh guidelines, everything possible is
  63.            kept in the resource file: window description, menus,
  64.            dialog specification, and the "About Skel" and other strings.
  65.  
  66.            In addition, the resource file handles the Bundle, File
  67.        References, and Icons that determine what Skel's icon looks 
  68.        like, and other information for the Finder.
  69.  
  70. How do I use SKEL?
  71.            Study it.  Modify it to test your knowledge.  Steal working
  72.            pieces of code for your own programs.  Beat on it.  Subject
  73.            it to cruel and unusual experiments.  Pay heed to its warnings.
  74.  
  75. What do I study first in SKEL?
  76.            Initially you should ignore several sections of SKEL, and the
  77.        calls made to them.  I recommend X-ing them out in your listing.
  78.            The sections to ignore on the first round of study are:
  79.  
  80.                Report: ignore the implementation
  81.                SetUpMemory: ignore all of it
  82.                DrawWindow: ignore the scroll bar and grow icon handling
  83.                ReSize: ignore all of it
  84.                DoCommand: ignore the Desk Accessory handling in the
  85.               Apple Menu
  86.                MainEventLoop:
  87.                   mouseDown handling: ignore inSysWindow, inDrag, inGrow
  88.                   keyDown, autoKey handling: ignore this.
  89.  
  90.            In the resource definition file, SKEL.R:
  91.                Finder information (offset by asterisks):
  92.                   ignore this whole section, icons and all.
  93.  
  94. What should I read in Inside Macintosh?
  95.            You should read the following sections of Inside Macintosh,
  96.            in the order given.  At first, just lightly skim the sections
  97.            with parenthesized names.  Read the others in some depth.  Read
  98.            the starred (*) ones in great detail.  Eventually, you will
  99.        have to read all sections thoroughly, and many many times, 
  100.        I promise you.
  101.  
  102.            To start:
  103.              * Inside Macintosh: A Road Map
  104.                (User Interface Guidelines)
  105.                Structure of a Macintosh Application
  106.              * Putting Together a Macintosh Application
  107.  
  108.            Then, (low-level sections are listed first):
  109.             *  Memory Mgr Intro
  110.               (Memory Mgr)
  111.             *  Resource Mgr (through "Using the Resource Mgr")
  112.             *  QuickDraw
  113.               (Desk Mgr)
  114.             *  Event Mgr (through "Event Mgr routines")
  115.                Window Mgr
  116.                Menu Mgr
  117.               (Dialog Mgr)
  118.  
  119. How do I get SKEL to run?
  120.            With Version 2.0 of the Megamax Compiler, run "batch" with
  121.        the input file "Skel.bat".
  122.               
  123. What is the history of SKEL?
  124.       v1.0 July 14, 1984   sm: major revision of earlier version
  125.            Sept 30, 1984   sm: used \14 for apple symbol in res. file,
  126.                                bracketed OpenDeskAcc with Get and SetPort,
  127.            Oct 11, 1984   sm:  changed FREF, BNDL resources from HEXA
  128.                                   to readable,
  129.                                nested some routines in SKEL,
  130.                                added constants for FILE menu items,
  131.       v2.0 Nov 12, 1984   sm:  made resources pre-loaded and/or purgeable,
  132.                                turned off range-checking,
  133.                                documented no Resume proc passed to
  134.                       InitDialogs,
  135.                                added SetUpMemory:
  136.                                   calls MoreMasters, MaxApplZone,
  137.                                   sets the NIL address to -1,
  138.                                   lots of general memory doc.
  139.                                added a warning about passing doubly-
  140.                                   dereferenced handles,
  141.                                   removed en/disabling of Rattle and 
  142.                   Frighten items,
  143.       v2.1 Dec 4, 1984    sm:    added menu key handling,
  144.                 put Rattle and Frighten strings in res file,
  145.                 rewrote intro documentation
  146.  
  147.       v2.2 Mar 6, 1985    sm:    converted to % describes,
  148.                 Fixed SKELX for both 2.0 and 3.0 workshop,
  149.                 set the event mask
  150.       
  151.       v2.2C 3/11/85  whj:    converted to Megamax "C"; future Megamax "C"
  152.                            version numbers will have the same version
  153.                 number as the corresponding Pascal version,
  154.                 but with an appended "C".
  155.       
  156.       v2.2.1C 4/1/85 whj:    Added in-place conversion of Pascal strings
  157.                       to C strings for the string resources.  Uses
  158.                 new procedure "initStrRes", included in
  159.                 this file.  This is a kludge required because
  160.                 the RMaker program supplied does not
  161.                 support C-Style strings.  v. 2.0 of Megamax C
  162.                 is different in its handling of string
  163.                 resources than v. 1.2, which necessitated this
  164.                 change.  Strings resources must not be 
  165.                 purgeable for this to work.  
  166.                 
  167.                 Also modified the header file "qdvars.h" which was
  168.                 supplied with Megamax C v. 2.0.  Use the new version
  169.                 in place of the Megamax version; the interface will
  170.                 be similar to the Lisa Pascal interface.
  171.                    
  172.     v.2.2.2C 5/20/85 whj:    Corrected two minor bugs reported on Usenet.
  173.                 The bugs apparently had no effect on the operation
  174.                 of the program.
  175.                    
  176.                 The distribution version of the program has been
  177.                 converted to Inside Macintosh toolbox names using
  178.                 Convert.  To use with Megamax C Compiler, use
  179.                 Convert as distributed with Version 2.0, with the
  180.                 "-L" argument to get a file containing all lowercase
  181.                 toolbox calls.
  182.                 
  183.     v. 2.2.3C 8/1/85 whj:    C-Style strings put into the Resource Fork 
  184.                 following a suggestion of Joel West, of CACI, Inc 
  185.                     (USENET: gould9!joel; ARPANET: gould9!joel@NOSC.ARPA).
  186.                   This uses the RMaker type 'GNRL' to Create 
  187.                    null-terminated strings in the Resource Fork.
  188.                 "initStrRes" kludge eliminated.Special handling 
  189.                 of periods (ASCII 2E) is required.  See skel.r for
  190.                 details.  Thank you, Joel!
  191.  
  192.  
  193.     v. 2.2.3LSC 6/16/86 mrp: Works under Lightspeed C now. Took out
  194.                 "C-style" strings; converted some &points; changed the
  195.                 includes; random others stuff.  Also broke up the source
  196.                 to better fit into Lightspeed's project organization.
  197.  
  198.  
  199. */
  200.